import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';
import { rules } from '@pkg/utils';
import { render } from '@apps/antd-admin/src/hooks/render/renderUtils';
import { RenderType } from '@pkg/setting';
import { weChatList } from '@apps/ant-bus/src/views/business/platformManage/wechat/data/api';

export const columns: BasicColumn[] = [
  {
    title: '封面图',
    dataIndex: 'sliderImg',
    width: 70,
    customRender: render.renderImage,
  },
  {
    title: '专题名称',
    dataIndex: 'sliderTitle',
    width: 130,
  },
  {
    title: '发布状态',
    dataIndex: 'sendStatus',
    width: 60,
    dictCode: 'publishStatus',
    customRender: render.renderDict,
  },
  {
    title: '排序',
    dataIndex: 'sortOrder',
    width: 40,
    sorter: {
      multiple: 1,
    },
  },
  {
    title: '创建日期',
    dataIndex: 'createTime',
    width: 80,
    sorter: {
      multiple: 2,
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'sliderTitle',
    label: '专题名称',
    component: 'Input',
    colProps: { span: 4 },
  }
];

export const formSchema: FormSchema[] = [
  {
    label: '专题名称',
    field: 'sliderTitle',
    component: 'Input',
    required: true,
  },
  {
    label: '跳转地址',
    field: 'content',
    component: 'InputTextArea',
    rules: rules.url(true),
    ifShow: ({ values }) => {
      return values.jumpType == '1';
    },
  },
  {
    label: '排序号',
    field: 'sortOrder',
    component: 'InputNumber',
    required: true,
  },
  {
    label: '图片',
    field: 'sliderImg',
    component: 'ImageUpload',
    itemProps:{
      extra:"建议尺寸200*230",
    },
  },
];
